<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <script type="text/javascript">
        var scope = "全局";
        function checkscope() {
            alert(scope);
            var scope = "局部";
            alert(scope);
        }
        checkscope();
    </script>

</body>
</html>